package priv.yiyuan.example.design.wrapper;

/**
 * 高级简历建造者
 * <p>
 * 建造者模式-具体建造者
 *
 * @author YiYuan
 * @data 2025/9/3
 * @apoNote
 */
public class AdvancedResumeBuilder implements ResumeBuilder {

    private Resume resume;

    public AdvancedResumeBuilder() {
        this.resume = new Resume();
    }

    @Override
    public void buildBasicInfo(String info) {
        resume.setBasicInfo(info);
    }

    @Override
    public void buildEducation(String edu) {
        ResumeElement eduElement = new FormatterDecorator(new TextElement(edu), "[教育]", "");
        resume.addEducation(eduElement.render());
    }

    @Override
    public void buildWorkExperience(String workExp) {
        ResumeElement workExpElement = new HighlightDecorator(new TextElement(workExp));
        resume.addWorkExperience(workExpElement.render());
    }

    @Override
    public void buildProjects(String project) {
        ResumeElement projectElement = new HighlightDecorator(new TextElement(project));
        resume.addProject(projectElement.render());
    }

    @Override
    public void buildSkills(String skill) {
        ResumeElement skillElement = new FormatterDecorator(new TextElement(skill), "<技能>", "</技能>");
        resume.addSkill(skillElement.render());
    }


    @Override
    public void buildAwards(String award) {
        ResumeElement awardElement = new HighlightDecorator(new TextElement(award));
        resume.addAward(awardElement.render());
    }

    @Override
    public void buildPublications(String publication) {
        ResumeElement pubElement = new FormatterDecorator(new TextElement(publication), "《", "》");
        resume.addPublication(pubElement.render());
    }
    @Override
    public Resume build() {
        return this.resume;
    }
}
